package net.liteheaven.testfile;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by LiangYu on 2018/6/20.
 */
public class FragmentB extends BaseFragment implements View.OnClickListener{

    public static FragmentB newInstance(){
        FragmentB f = new FragmentB();
        return f;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.fragment_b, container, false);
        View back = v.findViewById(R.id.back);
        back.setOnClickListener(this);
        View next = v.findViewById(R.id.next);
        next.setOnClickListener(this);
        return v;
    }

    @Override
    public void onClick(View v) {
        FragmentStackActivity activity = (FragmentStackActivity)getActivity();
        switch (v.getId()){
            case R.id.back:
                activity.onEvent(2, 1);
                break;
            case R.id.next:
                activity.onEvent(2, 2);
                break;
        }
    }
}
